package com.bmp.action;

import junit.framework.TestCase;

import org.junit.Assert;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class testAction extends TestCase {
	@Test
	public void testLoad() {
		ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
		UserAction ua = (UserAction)ctx.getBean("userManager");
		UserAction u = new UserAction();
		u.setUsername("1");
		ua.load();
		Assert.assertTrue(ua.getUser()!=null);
	}
	@Test
	public void testDelete(){
		ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
		UserAction ua = (UserAction)ctx.getBean("userManager");
		UserAction u = new UserAction();
		u.setId(1);
		ua.deleteUser();
		Assert.assertNull(u.getId());
	}
}
